<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <script type="text/javascript" src="/script/jquery-1.8.3.min.js"></script>
        <script type="text/javascript" src="/script/jquery_center.js"></script>
        <style>
            .ui-widget,.ui-widget .ui-widget {
                font-size: 80% !important;
            }
            .center
            {
                margin:auto;
                width:70%;
                vertical-align: middle;
            }
            body {
                background-image: url(../images/BCTrading.jpg);
                background-repeat: no-repeat;
                background-attachment: fixed;
                background-position:center top;
            }
        </style>
        <title>User List</title>
    </h:head>
    <h:body>

        <ui:include src="../topmenu.xhtml"/>

        <div id="principal"> 
            <p:ajaxStatus style="width:64px;height:64px;right:5px;bottom:5px">  
                <f:facet name="start">  
                    <p:graphicImage value="../images/loading.gif" />  
                </f:facet>  

                <f:facet name="complete">  
                    <h:outputText value="" />  
                </f:facet>  
            </p:ajaxStatus> 

            <h:form id="form">
                <p:dataTable id="userTable"  var="user" value="#{userBackBean.userList}"> 
                    <p:column headerText="Name">
                        <h:outputText value="#{user.name}"/>
                    </p:column>
                    <p:column headerText="Login">
                        <h:outputText value="#{user.login}"/>
                    </p:column>  
                    <p:column headerText="Dt Insert" style="width:120px;white-space: nowrap">  
                        <h:outputText value="#{user.createDt}" >
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm" />
                        </h:outputText> 
                    </p:column>
                    <p:column headerText="Dt Update" style="width:120px;white-space: nowrap">  
                        <h:outputText value="#{user.updateDt}" >
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm" />
                        </h:outputText>
                    </p:column>
                    <p:column headerText="Actions" style="width:80px;white-space: nowrap">                   
                        <p:commandButton id="editButton" update=":userDialogForm:userPanelGrid" oncomplete="userDialogW.show();" icon="ui-icon-pencil" title="Edit">
                            <f:setPropertyActionListener value="#{user}" target="#{userBackBean.selectedUser}" />
                            <f:setPropertyActionListener value="#{false}" target="#{userBackBean.isNew}" />
                        </p:commandButton>
                    </p:column>
                </p:dataTable>
                <p:commandButton id="addButton" value="Add User" update=":userDialogForm:userPanelGrid" actionListener="#{userBackBean.addUser}" oncomplete="userDialogW.show();" icon="ui-icon-plusthick" title="Add"/>

                <p:commandButton  id="cbtGerarRelatorio" value="Gerar Relatório" onclick="this.form.target = '_blank';" action="#{userBackBean.pdf}"
                                  ajax="false" />

                <p:commandButton  id="Teste2" value="Imprime" onclick="this.form.target = '_blank';" actionListener="#{userBackBean.imprime}"
                                  ajax="false" />                      

            </h:form>


            <ui:include src="userDialog.xhtml"/>

        </div>
        <script>
            $("#principal").center();
        </script>
    </h:body>
</html>